import React, { Component } from 'react'

import { Route, Link } from 'react-router-dom'


import Child1 from './views/Child1'
import Child2 from './views/Child2'

class App extends Component {

  render() {
    return (
      <>
        <li><Link to="/child1">Child1页面</Link></li>
        <li><Link to="/child2">Child2页面</Link></li>
        <hr />
        {/* 利用Route中的children渲染方式，它匹配成功 route对象中的match为对象，否则为null 可以给动画in属性写true/false */}
        <Route path="/child1" children={route => <Child1 {...route} />} />
        <Route path="/child2" children={route => <Child2 {...route} />} />

      </>
    )
  }

}

export default App
